// Copyright [2023] <wangyunlai>
// Created by root on 10/15/23.
//

#pragma once

#include <string>
#include <vector>

#include "sql/stmt/stmt.h"

class Db;
class Table;

/**
 * @brief 表示删除索引的语句
 * @ingroup Statement
 * @details 虽然解析成了stmt，但是与原始的SQL解析后的数据也差不多
 */
class DropIndexStmt : public Stmt {
 public:
  DropIndexStmt(Table *table, const std::string &index_name)
      : table_(table), index_name_(index_name) {}
  virtual ~DropIndexStmt() = default;

  StmtType type() const override { return StmtType::DROP_INDEX; }

  Table *table() const { return table_; }
  const std::string &index_name() const { return index_name_; }

  static RC create(Db *db, const DropIndexSqlNode &drop_index, Stmt *&stmt);

 private:
  Table *table_;
  std::string index_name_;
};
